package com.bdcom.autotest.interaction.step.remodel;

import com.bdcom.autotest.interaction.bean.DeviceUpdBean;
import com.bdcom.autotest.interaction.http.ConsoleServerOper;
import com.bdcom.autotest.interaction.step.IStepHandler;
import com.bdcom.autotest.interaction.step.StepThread;
import com.bdcom.autotest.util.Prop;

import java.util.List;

public class ValidateDev implements IStepHandler{

	
	@Override
	public boolean runStep(StepThread mainrun) {

		return true;
	}

	private boolean validateBaud(StepThread mainrun){
		String oldBaud = mainrun.getBaud();
		List<DeviceUpdBean> deviceUpdBeanList = mainrun.getDeviceUpdBeanList();
		for(DeviceUpdBean deviceUpdBean:deviceUpdBeanList){
			if(!oldBaud.equals(deviceUpdBean.getNewBaud())){
				int result = ConsoleServerOper.setBaudRate(Prop.console_server_ip, oldBaud);
				if (result == ConsoleServerOper.SETRES_SUCCESS) {
					mainrun.addLog("设置console服务器波特率:" +oldBaud+"成功");
				} else if (result == ConsoleServerOper.SETRES_SETFAIL) {
					mainrun.addErrorLog("设置console服务器波特率失败");
					return false;
				} else if (result == ConsoleServerOper.SETRES_REBOOTFAIL) {
					mainrun.addErrorLog("console服务器重启失败");
					return false;
				}
			}else{

			}
		}
		return true;
	}

	private boolean valideDevice(DeviceUpdBean deviceUpdBean){
		return true;
	}
}

